public class Main {
    public static void main(String[] args) {
        System.out.println("1 到 10000 之间的完数有：");

        for (int num = 2; num <= 10000; num++) {
            int sum = 1; // 1 是所有大于1的数的因数

            for (int i = 2; i <= Math.sqrt(num); i++) {
                if (num % i == 0) {
                    int complement = num / i;
                    if (i == complement) {
                        sum += i;
                    } else {
                        sum += i + complement;
                    }
                }
            }
            if (sum == num) {
                System.out.println(num);
            }
        }
    }
}